 /* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

京东云iotlink接口
iotlink相关接口

OpenAPI spec version: v1
Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/


#import <Foundation/Foundation.h>
#import <JDCloudOCSDKIotlink/IotlinkExecutor.h>

@implementation IotlinkClient

@synthesize userAgent = _userAgent;
@synthesize serviceName = _serviceName;
@synthesize version = _version;

-(void) addCustomerHeaderWithKey:(NSString*) key
                           value:(NSString*) value{
    if(![self customHeader])
    {
        self.customHeader = [[NSMutableDictionary alloc] init];
    }
    if(key && value)
    {
        [[self customHeader] setValue:value forKey:key];
    }
   
}

-(id)initWithGlobalConfig{
    if(![GlobalConfig credential])
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@"GlobalConfig credential not config" userInfo:nil];
        @throw e;
    }
    self.credential = [GlobalConfig credential];
    if(![GlobalConfig sdkEnvironment])
    {
        self.sdkEnvironment = [[SDKEnvironment alloc] initWithEndPoint:@"iotlink.jdcloud-api.com"];
    }else
    {
        self.sdkEnvironment = [GlobalConfig sdkEnvironment];
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 iotlink  v1";
    _serviceName = @"iotlink";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}

-(id)initWithCredential:(Credential*)credential
         sdkEnvironment:(SDKEnvironment*)sdkEnvironment
{
    if(!credential)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" credential can not null" userInfo:nil];
        @throw e;
    }else{
        self.credential = credential;
    }
    
    if(!sdkEnvironment)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" sdkEnvironment can not null" userInfo:nil];
        @throw e;
    }else{
        self.sdkEnvironment = sdkEnvironment;
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 iotlink  v1";
    _serviceName = @"iotlink";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}

-(id)initWithCredential:(Credential*)credential
{
    if(!credential)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" credential can not null" userInfo:nil];
        @throw e;
    }else{
        self.credential = credential;
    }
    if(![GlobalConfig sdkEnvironment])
    {
        self.sdkEnvironment = [[SDKEnvironment alloc] initWithEndPoint:@"iotlink.jdcloud-api.com"];
    }else
    {
        self.sdkEnvironment = [GlobalConfig sdkEnvironment];
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 iotlink  v1";
    _serviceName = @"iotlink";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}

-(id)init{
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 iotlink  v1";
    _serviceName = @"iotlink";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}


/**
onOffStatus sync request
@param onOffStatusRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `onOffStatusResponse` the request response data model
*/
-(NSDictionary*) onOffStatusSyncWithRequest:(IotlinkOnOffStatusRequest*) onOffStatusRequest
{
IotlinkOnOffStatusExecutor* excutor = [[IotlinkOnOffStatusExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:onOffStatusRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkOnOffStatusResponse* response = [[IotlinkOnOffStatusResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"onOffStatusResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)onOffStatusAsyncWithRequest:(IotlinkOnOffStatusRequest*) onOffStatusRequest
                       completionHandler:(void(^)(int statusCode,IotlinkOnOffStatusResponse* _Nullable onOffStatusResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotlinkOnOffStatusExecutor* excutor = [[IotlinkOnOffStatusExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:onOffStatusRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkOnOffStatusResponse* response = [[IotlinkOnOffStatusResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
openIotCard sync request
@param openIotCardRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `openIotCardResponse` the request response data model
*/
-(NSDictionary*) openIotCardSyncWithRequest:(IotlinkOpenIotCardRequest*) openIotCardRequest
{
IotlinkOpenIotCardExecutor* excutor = [[IotlinkOpenIotCardExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:openIotCardRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkOpenIotCardResponse* response = [[IotlinkOpenIotCardResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"openIotCardResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)openIotCardAsyncWithRequest:(IotlinkOpenIotCardRequest*) openIotCardRequest
                       completionHandler:(void(^)(int statusCode,IotlinkOpenIotCardResponse* _Nullable openIotCardResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotlinkOpenIotCardExecutor* excutor = [[IotlinkOpenIotCardExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:openIotCardRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkOpenIotCardResponse* response = [[IotlinkOpenIotCardResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
closeIotCard sync request
@param closeIotCardRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `closeIotCardResponse` the request response data model
*/
-(NSDictionary*) closeIotCardSyncWithRequest:(IotlinkCloseIotCardRequest*) closeIotCardRequest
{
IotlinkCloseIotCardExecutor* excutor = [[IotlinkCloseIotCardExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:closeIotCardRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkCloseIotCardResponse* response = [[IotlinkCloseIotCardResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"closeIotCardResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)closeIotCardAsyncWithRequest:(IotlinkCloseIotCardRequest*) closeIotCardRequest
                       completionHandler:(void(^)(int statusCode,IotlinkCloseIotCardResponse* _Nullable closeIotCardResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotlinkCloseIotCardExecutor* excutor = [[IotlinkCloseIotCardExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:closeIotCardRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkCloseIotCardResponse* response = [[IotlinkCloseIotCardResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
lifeStatus sync request
@param lifeStatusRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `lifeStatusResponse` the request response data model
*/
-(NSDictionary*) lifeStatusSyncWithRequest:(IotlinkLifeStatusRequest*) lifeStatusRequest
{
IotlinkLifeStatusExecutor* excutor = [[IotlinkLifeStatusExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:lifeStatusRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkLifeStatusResponse* response = [[IotlinkLifeStatusResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"lifeStatusResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)lifeStatusAsyncWithRequest:(IotlinkLifeStatusRequest*) lifeStatusRequest
                       completionHandler:(void(^)(int statusCode,IotlinkLifeStatusResponse* _Nullable lifeStatusResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotlinkLifeStatusExecutor* excutor = [[IotlinkLifeStatusExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:lifeStatusRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkLifeStatusResponse* response = [[IotlinkLifeStatusResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
closeIotFlow sync request
@param closeIotFlowRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `closeIotFlowResponse` the request response data model
*/
-(NSDictionary*) closeIotFlowSyncWithRequest:(IotlinkCloseIotFlowRequest*) closeIotFlowRequest
{
IotlinkCloseIotFlowExecutor* excutor = [[IotlinkCloseIotFlowExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:closeIotFlowRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkCloseIotFlowResponse* response = [[IotlinkCloseIotFlowResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"closeIotFlowResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)closeIotFlowAsyncWithRequest:(IotlinkCloseIotFlowRequest*) closeIotFlowRequest
                       completionHandler:(void(^)(int statusCode,IotlinkCloseIotFlowResponse* _Nullable closeIotFlowResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotlinkCloseIotFlowExecutor* excutor = [[IotlinkCloseIotFlowExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:closeIotFlowRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkCloseIotFlowResponse* response = [[IotlinkCloseIotFlowResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
gprsStatus sync request
@param gprsStatusRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `gprsStatusResponse` the request response data model
*/
-(NSDictionary*) gprsStatusSyncWithRequest:(IotlinkGprsStatusRequest*) gprsStatusRequest
{
IotlinkGprsStatusExecutor* excutor = [[IotlinkGprsStatusExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:gprsStatusRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkGprsStatusResponse* response = [[IotlinkGprsStatusResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"gprsStatusResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)gprsStatusAsyncWithRequest:(IotlinkGprsStatusRequest*) gprsStatusRequest
                       completionHandler:(void(^)(int statusCode,IotlinkGprsStatusResponse* _Nullable gprsStatusResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotlinkGprsStatusExecutor* excutor = [[IotlinkGprsStatusExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:gprsStatusRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkGprsStatusResponse* response = [[IotlinkGprsStatusResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
openIotFlow sync request
@param openIotFlowRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `openIotFlowResponse` the request response data model
*/
-(NSDictionary*) openIotFlowSyncWithRequest:(IotlinkOpenIotFlowRequest*) openIotFlowRequest
{
IotlinkOpenIotFlowExecutor* excutor = [[IotlinkOpenIotFlowExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:openIotFlowRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkOpenIotFlowResponse* response = [[IotlinkOpenIotFlowResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"openIotFlowResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)openIotFlowAsyncWithRequest:(IotlinkOpenIotFlowRequest*) openIotFlowRequest
                       completionHandler:(void(^)(int statusCode,IotlinkOpenIotFlowResponse* _Nullable openIotFlowResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotlinkOpenIotFlowExecutor* excutor = [[IotlinkOpenIotFlowExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:openIotFlowRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkOpenIotFlowResponse* response = [[IotlinkOpenIotFlowResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
gprsRealtimeInfo sync request
@param gprsRealtimeInfoRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `gprsRealtimeInfoResponse` the request response data model
*/
-(NSDictionary*) gprsRealtimeInfoSyncWithRequest:(IotlinkGprsRealtimeInfoRequest*) gprsRealtimeInfoRequest
{
IotlinkGprsRealtimeInfoExecutor* excutor = [[IotlinkGprsRealtimeInfoExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:gprsRealtimeInfoRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkGprsRealtimeInfoResponse* response = [[IotlinkGprsRealtimeInfoResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"gprsRealtimeInfoResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)gprsRealtimeInfoAsyncWithRequest:(IotlinkGprsRealtimeInfoRequest*) gprsRealtimeInfoRequest
                       completionHandler:(void(^)(int statusCode,IotlinkGprsRealtimeInfoResponse* _Nullable gprsRealtimeInfoResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
IotlinkGprsRealtimeInfoExecutor* excutor = [[IotlinkGprsRealtimeInfoExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:gprsRealtimeInfoRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    IotlinkGprsRealtimeInfoResponse* response = [[IotlinkGprsRealtimeInfoResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}


 /**
 iotlink common sync request
 @param  jdcloudDataRequest request param
 @return key `statusCode` http request status code type is int
             `dataResult` the http request response data  type is NSData
             `requestError` the request error type is NSError
 */
 -(NSDictionary*) iotlinkCommonSyncWithRequest:(JDCloudDataRequest*) jdcloudDataRequest
                                                   url:(NSString*) url
                                                method:(NSString*) method{
    CommonExecutor* excutor = [[CommonExecutor alloc] initWithJDCloudClient:self url:url method:method];
    NSDictionary* responseResult = [excutor executeDataSync:jdcloudDataRequest];
    return responseResult;
}

-(void)iotlinkCommonAsyncWithRequest:(JDCloudDataRequest*) jdcloudDataRequest
                                         url:(NSString*) url
                                      method:(NSString*) method
                           completionHandler:(void(^)(int statusCode, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
     CommonExecutor* excutor = [[CommonExecutor alloc] initWithJDCloudClient:self url:url method:method];
    
    [excutor executeDataAsync:jdcloudDataRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        completionHandler(statusCode,responseData,error);
    }];
} 

@end
